<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<%@ include file="../../../commons/taglibs.jsp"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
		<base href="<%=basePath%>">
		<title>列表</title>
		<meta http-equiv="pragma" content="no-cache">
		<meta http-equiv="cache-control" content="no-cache">
		<meta http-equiv="expires" content="0">
		<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
		<meta http-equiv="description" content="This is my page">
</head>
<body>

		<form id="queryForm" name="queryForm" method="post" 	>
			<div id="tab_bd1">
				<div class="title">
					<div class="left">
						查询筛选
					</div>
				</div>
				<div class="frame">
					<table width="100%" border="0" cellpadding="1" cellspacing="1" bordercolor="#CCCCCC" bgcolor="#CCCCCC" align="center">
						<tr>
							<td class="lbg" width="120">
								开始日期：
							</td>
							<td>
								<input name="beginDate" id="beginDate" type="text" size="30" onClick="WdatePicker({dateFmt:'yyyy-MM-dd'})">
							</td>
							<td class="lbg" width="120">
								结束日期：
							</td>
							<td>
								<input name="endDate" id="endDate" type="text" size="30" onClick="WdatePicker({dateFmt:'yyyy-MM-dd'})">
							</td>
						</tr>
						

						<tr>
							<td class="lbg" width="60" colspan="8">
								<a id="btn" href="javascript:queryUi()" class="easyui-linkbutton" data-options="iconCls:'icon-search'">查询</a>
								<a id="btn" href="javascript:rebackUi()" class="easyui-linkbutton" data-options="iconCls:'icon-reload'">返回</a>
							</td>
						</tr>
					</table>
				</div>
			</div>
		</form>

		<!-- 数据集合部分 -->	
	<table id="list_data" > </table>
		
	<script type="text/javascript">
	function getNowFormatDate() {
	    var date = new Date();
	    var seperator1 = "-";
	    var seperator2 = ":";
	    var year = date.getFullYear();
	    var month = date.getMonth() + 1;
	    var strDate = date.getDate();
	    if (month >= 1 && month <= 9) {
	        month = "0" + month;
	    }
	    if (strDate >= 0 && strDate <= 9) {
	        strDate = "0" + strDate;
	    }
	    var currentdate = year + seperator1 + month + seperator1 + strDate;
	    return currentdate;
	}
	
	/**  页面加载自动加载datagrid数据 **/
	$(function(){
			//var curr=getNowFormatDate();
			$('#list_data').datagrid({  
		        title:'订单流水',  
		        iconCls:'icon-edit',// 图标
		        width: 'auto',  
		        height:'auto',  
		        nowrap: false,  
		        striped: true,  
		        border: true,  
		        loadMsg:'数据加载中请稍后……',
		        collapsible:true,// 是否可折叠的
		        fit: false,// 自动大小
		        url:'<%=path %>/order/totalList',  
		        remoteSort:false,   
		        singleSelect:false,// 是否单选
		        pagination:true,// 分页控件
		        pageSize: 20,// 每页显示的记录条数，默认为10
		        pageList: [10,20,50],// 可以设置每页记录条数的列表
		        rownumbers:true,// 行号
		        columns:[[
		                  {field:'createdate',title:'日期',width:180,align:'center'},
		                  {field:'order_cnt',title:'成交数量',width:200,align:'center'},
		                  {field:'order_sum_fee',title:'总金额',width:150,align:'center'},
		                  {field:'discount_fee',title:'总折折扣金额',width:100,align:'center'},
		                  {field:'real_sum_fee',title:'实际收入',width:100,align:'center'},
		                  {field:'food_total',title:'卖出菜品总数',width:100,align:'center'},
		                  ]],
		        frozenColumns:[[  
		            {field:'id',checkbox:true}  
		        ]],
		        toolbar: [{  
		            text: '点单',  
		            iconCls: 'icon-add',  
		            handler: function() {  
		            	window.parent.openTab("点单",'<%=path %>/order/beginOrder'); 
		             	//addDialogTag("<%=path %>/jsp/OutMenu/form.jsp",'添加菜单','<%=path %>/menu/createOrUpdate','450','420');   
		            }  
		        }]
		    });  

			var p = $('#list_data').datagrid('getPager');  
		    $(p).pagination({  
		        pageSize: 20,//每页显示的记录条数，默认为10  
		        pageList: [10,20,50],//可以设置每页记录条数的列表  
		        beforePageText: '第',//页数文本框前显示的汉字  
		        afterPageText: '页     共{pages}页',  
		        displayMsg: '当前显示 {from} - {to} 条记录   共 {total}条记录'
		    }); 
	}); 	
	
	function upStatus(id){
		
			$.ajax( {
				cache : true,
				type : "POST",
				url : '<%=path %>/order/upStatus',
				data : {
						id:id
				},
				async : false,
				error : function(request) {
					$.messager.alert('提示',"操作失败！", 'warning');
				},
				success : function(data) {
					$.messager.alert('提示',"退单成功！", 'info!');
			}
		})	
		
	}
</script>
</body>	
</html>
	
